//
// Created by 孟令涛 on 24-7-14.
//
#include "main.h"
#include "utils.h"
#include "tim.h"

void HAL_Delay_us(uint16_t us) {
    __HAL_TIM_SET_COUNTER(&htim2, 0);  // 设置计数器值为0
    while (__HAL_TIM_GET_COUNTER(&htim2) < us);  // 等待计数器值达到us
}

void EnterCriticalSection(void) {
    // 进入临界区
    osKernelLock();
}

void ExitCriticalSection(void) {
    // 退出临界区
    osKernelUnlock();
}